from pydantic_settings import BaseSettings
from pathlib import Path


class Settings(BaseSettings):
    """应用配置"""
    # API Keys
    GEMINI_API_KEY: str

    # 路径配置
    IMAGE_OUTPUT_PATH: str = "./output"
    
    # 生成配置
    PROMPT_COUNT: int = 10
    
    # 服务器配置
    HOST: str = "0.0.0.0"
    PORT: int = 8000

    class Config:
        env_file = ".env"
        env_file_encoding = 'utf-8'

    def initialize(self):
        """初始化必要的目录"""
        output_path = Path(self.IMAGE_OUTPUT_PATH)
        output_path.mkdir(parents=True, exist_ok=True)


settings = Settings()
